package com.augurit.gzcgwsp.csshlj.service.impl;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.VerticalAlignment;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import org.apache.log4j.Logger;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.history.HistoryTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;

import com.augurit.common.system.web.auth.form.LoginUserForm;
import com.augurit.common.util.HqlUtils;
import com.augurit.common.util.PageUtils;
import com.augurit.common.util.lang.StringUtils;
import com.augurit.gzcgwsp.commonex.util.lang.DateUtilsEX;
import com.augurit.gzcgwsp.csshlj.convert.ShljqsBaConvertor;
import com.augurit.gzcgwsp.csshlj.dao.ShljqsBaDao;
import com.augurit.gzcgwsp.csshlj.entity.ShljProject;
import com.augurit.gzcgwsp.csshlj.entity.ShljqsBa;
import com.augurit.gzcgwsp.csshlj.form.ShljYsForm;
import com.augurit.gzcgwsp.csshlj.form.ShljqsBaForm;
import com.augurit.gzcgwsp.csshlj.service.IShljYsService;
import com.augurit.gzcgwsp.csshlj.service.IShljqsBaService;
import com.augurit.gzcgwsp.excelimportexport.util.ExcelUtil;
import com.augurit.gzcgwsp.excelimportexport.util.GetFileName;
import com.augurit.gzcgwsp.sendNotice.service.IExchangeStateService;
import com.augurit.gzcgwsp.sendNotice.service.IYwMtbjlshInfoService;
import com.augurit.gzcgwsp.sendNotice.service.IYwWebserviceForWbService;
import com.augurit.gzcgwsp.sendNotice.service.IYwWebserviceInfoService;
import com.augurit.gzcgwsp.smartformCsdlwj.dao.SmartFormShljqsDao;
import com.augurit.gzcgwsp.smartformCsdlwj.service.ISmartFormShljqsService;
import com.augurit.gzcgwsp.smartformCsdlwj.service.IYwHwXminfoService;
import com.augurit.gzcgwsp.smartformCsdlwj.web.form.ShljqsForm;
import com.augurit.gzcgwsp.wfex.common.service.IWfServiceEX;
import com.augurit.gzcgwsp.ywcmn.service.IYwComSjclService;
import com.augurit.wf.app.doccode.service.IOaDocCodeService;
import com.augurit.wf.app.doccode.web.form.OaDocCodeForm;
import com.augurit.wf.bi.web.form.WfBusInstanceTaskForm;
import com.augurit.wf.client.summary.convert.WfTaskSummaryConvertor;
import com.augurit.wf.client.summary.web.form.WfTaskSummaryForm;
import com.augurit.wf.common.dao.Jbpm4HistTaskDao;
import com.augurit.wf.common.entity.WfBusInstance;
import com.augurit.wf.common.service.impl.WfBusClientServiceImpl;

@Service
@Transactional
public class ShljqsBaServiceImpl extends WfBusClientServiceImpl<ShljqsBaForm> implements IShljqsBaService{
	private static final Logger log=Logger.getLogger(ShljqsBaServiceImpl.class);
	@Autowired
	private ShljqsBaDao shljqsBaDao;
    @Autowired
    private IOaDocCodeService doccodeService;
    @Autowired
    private IYwComSjclService sjclService;
	@Autowired
	private ISmartFormShljqsService smartFormShljqsService;
	@Autowired
	private Jbpm4HistTaskDao jbpm4HistTaskDao;
	@Autowired
	private IShljYsService shljYsService;
	@Autowired//道路挖掘dao
    private SmartFormShljqsDao smartFormShljqsDao;
	@Autowired
	private IYwHwXminfoService ywHwXminfoService;
	@Autowired
    private IYwMtbjlshInfoService ywMtbjlshInfoService;
    @Autowired
	private IYwWebserviceInfoService ywWebserviceInfoService;
    @Autowired
    private IYwWebserviceForWbService ywWebserviceForWbService;
    @Autowired
    private IExchangeStateService exchangeStateService;
    @Autowired
    private IWfServiceEX wfServiceEX;
    
	/**
	 * ��������ȡForm����
	 */
	@Transactional(readOnly = true)
	public ShljqsBaForm get(Long id) {
		ShljqsBa entity = shljqsBaDao.get(id);
		ShljqsForm qsForm =	smartFormShljqsService.get(entity.getYsid());
		qsForm=smartFormShljqsService.getForm(entity.getYsid(), "hw_shljqs_v1");
		//qsForm = getForm(entity, "hw_shljqs_v1", qsForm);
		ShljqsBaForm form=ShljqsBaConvertor.convertVoToForm(entity, qsForm);
		form.setProjectName(entity.getProjectName());
		form.setIsprint(entity.getIsprint());
		return form;
	}

	public ShljqsForm getForm(ShljqsBa entity, String tablename ,ShljqsForm form) {
		String sql=" select *　from "+tablename+" where id="+entity.getYsid();
		List list=smartFormShljqsDao.queryForList(sql);
		  if(list!=null && list.size()>0){
   		   Map<String,String> map=(Map<String,String>) list.get(0);
             form.setSqdw(map.get("qymc"));
             form.setZsbh(map.get("fzh"));
             form.setYyzch(map.get("yyzzzch"));
             form.setFddbr(map.get("frdb"));
             form.setQybh(map.get("qybh"));
//             form.setProjectName(map.get("projectname"));
//             form.setXkContent((map.get("xkcontent")));
             
             form.setProjectName(map.get("xmmc"));//项目名称
             form.setXkContent((map.get("xkcontent")));
             String startDate=map.get("jysjsstr");//经营开始时间
             String endDate=map.get("jysjestr");//经营结束时间
             String fzsj=map.get("fzsjstr");//发证时间
             if(StringUtils.isBlank(map.get("xkcontent"))){
            	 form.setXkContent("城市生活垃圾经营性清扫、收集、运输");
             }
             if(StringUtils.isNotBlank(startDate) && startDate.length()>=10){
     			form.setStartYear(startDate.substring(0,4));
     			form.setStartMonth(startDate.substring(5,7));
     			form.setStartDay(startDate.substring(8,10));
     		 }else{
     			form.setStartYear(DateUtilsEX.getCurYear());
     			form.setStartMonth(DateUtilsEX.getCurMonth());
     			form.setStartDay(DateUtilsEX.getCurDay());
     		 }
             if(StringUtils.isNotBlank(endDate) && endDate.length()>=10){
            	   form.setEndYear(endDate.substring(0,4));
        			form.setEndMonth(endDate.substring(5,7));
        			form.setEndDay(endDate.substring(8,10));
      		}else{
      			form.setEndYear(DateUtilsEX.getCurYear());
      			form.setEndMonth(DateUtilsEX.getCurMonth());
      			form.setEndDay(DateUtilsEX.getCurDay());
      		}
            if(StringUtils.isNotBlank(fzsj) && fzsj.length()>=10){
       			form.setFzYear(fzsj.substring(0,4));
       			form.setFzMonth(fzsj.substring(5,7));
       			form.setFzDay(fzsj.substring(8,10));
       		}else{
    			form.setFzYear(DateUtilsEX.getCurMonth());
      			form.setFzMonth(DateUtilsEX.getCurMonth());
      			form.setFzDay(DateUtilsEX.getCurDay());
       		}
             form.setJdTel(map.get("jdtel"));
             form.setAddress(map.get("address"));
             form.setQyMaangerZw(map.get("qymaangerzw"));
             form.setQyManager(map.get("qymanager"));
             form.setQyManagerZc(map.get("qymanagerzc"));
             form.setQylx(map.get("qylx"));
             form.setQygyzb(map.get("qygyzb"));
             form.setQygrzb(map.get("qygrzb"));
             form.setQyhzzb(map.get("qyhzzb"));
             form.setQywszb(map.get("qywszb"));
             form.setFddbrZc(map.get("fddbrzc"));
             form.setFddbrZw(map.get("fddbrzw"));
             form.setAddress(map.get("address"));
             form.setZczb(map.get("zczb"));
             form.setFzrq(map.get("fzrq"));
             form.setFzjg(map.get("fzjg")==null?"广州市城市管理委员会":map.get("fzjg"));
             
             form.setCbyw(map.get("cbyw"));
             form.setSjr(map.get("sjr"));
             
             
 			//设置收件通知书书签
             form.setCbyw2(form.getCbyw());
             form.setCbyw3(form.getCbyw());
             form.setCbyw4(form.getCbyw());
             form.setFrdb2(form.getFddbr());
             form.setAcceptNo2(map.get("accept_no"));
//             String tbrqStr = simpleDateFormat.format(form.getTbrq());
             form.setTbrq2(map.get("tbrq"));
             form.setTbrq3(map.get("tbrq"));
             form.setCurDate2(map.get("tbrq"));
             form.setCurDate3(map.get("tbrq"));
             form.setSjr2(form.getSjr());
             form.setSajg("广州市城市管理委员会");
             form.setSajg2(form.getSajg());
             form.setQymc2(form.getSqdw());
             form.setQymc(form.getSqdw());
             form.setFrdb(form.getFddbr());

//             List list2 =new ArrayList();
//             list2 = ywHwXminfoService.getFbXminfo(entity.getYsid(), "shljqssj");
//             list2.addAll(getfblist("shljqssjba",entity.getYsid()));
//             list2.addAll(ywHwXminfoService.getFbXminfo(entity.getId(), "shljqssjba"));
//             if(list2!=null && list2.size()>0){
//                 Map<String, String> map2 =(Map<String, String>) list2.get(0);
//                 form.setXmid1(Long.parseLong(map2.get("xmid")));
//                 form.setXmnr1(map2.get("xmnr"));
//                 form.setStartday1(map2.get("startday"));
//                 form.setEndday1(map2.get("endday"));
//                 form.setGzsj1(map2.get("gzsj"));
//                 if(list2.size()>1){
//                	 map2 =(Map<String, String>) list2.get(1);
//                     form.setXmid2(Long.parseLong(map2.get("xmid")));
//                     form.setXmnr2(map2.get("xmnr"));
//                     form.setStartday2(map2.get("startday"));
//                     form.setEndday2(map2.get("endday"));
//                     form.setGzsj2(map2.get("gzsj"));
//                 }
//                 if(list2.size()>2){
//                	 map2 =(Map<String, String>) list2.get(2);
//                     form.setXmid3(Long.parseLong(map2.get("xmid")));
//                     form.setXmnr3(map2.get("xmnr"));
//                     form.setStartday3(map2.get("startday"));
//                     form.setEndday3(map2.get("endday"));
//                     form.setGzsj3(map2.get("gzsj"));
//                 }
//                 if(list2.size()>3){
//                	 map2 =(Map<String, String>) list2.get(3);
//                     form.setXmid4(Long.parseLong(map2.get("xmid")));
//                     form.setXmnr4(map2.get("xmnr"));
//                     form.setStartday4(map2.get("startday"));
//                     form.setEndday4(map2.get("endday"));
//                     form.setGzsj4(map2.get("gzsj"));
//                 }
//                 if(list2.size()>4){
//                	 map2 =(Map<String, String>) list2.get(4);
//                     form.setXmid5(Long.parseLong(map2.get("xmid")));
//                     form.setXmnr5(map2.get("xmnr"));
//                     form.setStartday5(map2.get("startday"));
//                     form.setEndday5(map2.get("endday"));
//                     form.setGzsj5(map2.get("gzsj"));
//                 }
//                 if(list2.size()>5){
//                	 map2 =(Map<String, String>) list2.get(5);
//                     form.setXmid6(Long.parseLong(map2.get("xmid")));
//                     form.setXmnr6(map2.get("xmnr"));
//                     form.setStartday6(map2.get("startday"));
//                     form.setEndday6(map2.get("endday"));
//                     form.setGzsj6(map2.get("gzsj"));
//                 }
//             }
          }
		return form;
	}
	/**
	 * ɾ��Form�����б�
	 */
	public void delete(Long... ids) {
		shljqsBaDao.delete(ids);
	}

	/**
	 * �����������޸ĵ�Form�����б�
	 */
	public void save(ShljqsBaForm... forms) {
		if(forms != null)
			for(ShljqsBaForm form : forms)
				this.save(form);
	}
	
	/**
	 * �����������޸ĵ�Form����
	 */
	public void save(ShljqsBaForm form){
		
		if(form != null){
			ShljqsBa entity = null;
			
            OaDocCodeForm doccodeForm = doccodeService.get(10L);
			
			//׼��VO����
			if(form != null && form.getId() != null){
				entity = shljqsBaDao.get(form.getId());
				if (StringUtils.isBlank(entity.getAcceptNo()) || form.getAcceptNo().indexOf("XXXX") > 0) form.setAcceptNo(null);
			}else{
				entity = new ShljqsBa();
                form.setAcceptNo(null);
			}

	        
	        boolean isNewForm = false;
            if (StringUtils.isBlank(form.getAcceptNo())) {
            	//生成政务中心统一查询编号 开始
    			Map<String,String> serialNoAndPasswordMap = null;
            	if("Y".equals(form.getSendNotice())){//网办，1
            		serialNoAndPasswordMap = ywMtbjlshInfoService.getSerialNoAndPassword("1");
            	}else{//大厅，0
            		serialNoAndPasswordMap = ywMtbjlshInfoService.getSerialNoAndPassword("0");
            	}
            	String serialNo = serialNoAndPasswordMap.get("serialNo");
            	String password = serialNoAndPasswordMap.get("password");
    			form.setSerialNo(serialNo);
    			form.setPassword(password);
    			form.setAcceptNo(serialNo);
        		//生成政务中心统一查询编号 结束
                isNewForm = true;            
            }
         
			ShljqsBaConvertor.convertFormToVo(form, entity);
			shljqsBaDao.save(entity);
			form.setId(entity.getId());
			if (isNewForm) {
                sjclService.updateByNewForm(form.getId());
            }
		}
	}

	/**
	 * ���Form����Ĳ�ѯ��������ҳ��ѯ
	 */
	@Transactional(readOnly = true)
	public Page<ShljqsBaForm> search(Page<ShljqsBaForm> page, ShljqsBaForm form) {
		// �����µķ�ҳ����
		Page pg = PageUtils.newPageInstance(page);
		
		// ��ѯ��估����
		StringBuffer hql = new StringBuffer("from ShljqsBa ps where 1=1");
		List values = new ArrayList();
		
		// ��ѯ����
		if(form != null){
			
		}
		
		//����
		hql.append(HqlUtils.buildOrderBy(page, "ps"));
		
		// ִ�з�ҳ��ѯ����
		shljqsBaDao.findPage(pg, hql.toString(), values);
		
		// ת��ΪForm�����б?��ֵ��ԭ��ҳ������
		ShljqsBaConvertor convertor = new ShljqsBaConvertor();
		List<ShljqsBaForm> list = convertor.convertVoListToFormList(pg.getResult());
		PageUtils.copy(pg, list, page);
		return page;
	}
	
	/**
	 * ��ݹ��������б�����ҳ��ѯ
	 */
	@Transactional(readOnly = true)
	public Page<ShljqsBaForm> search(Page<ShljqsBaForm> page, List<PropertyFilter> filters) {
		// �����µķ�ҳ����
		Page<ShljqsBa> pg = PageUtils.newPageInstance(page);
		
		// ������������ҳ���Ҷ���
		shljqsBaDao.findPage(pg, filters);
		
		ShljqsBaConvertor convertor = new ShljqsBaConvertor();
		List<ShljqsBaForm> list = convertor.convertVoListToFormList(pg.getResult());
		PageUtils.copy(pg, list, page);
		return page;
	}
	
	public void changeYslState(Long id,Long state,String yslThyy) {
    	StringBuffer sql = new StringBuffer();
    	sql.append("update ShljqsBa t set t.ysl='"+state+"' ");
    	if(StringUtils.isNotBlank(yslThyy)){
    		sql.append(" ,t.yslThyy='"+yslThyy+"'");
    	}
    	sql.append(" where t.id="+id);
    	shljqsBaDao.getSession().createQuery(sql.toString()).executeUpdate();
    	System.out.println("陆域备案收件");
    }

	@Transactional(readOnly = true)
	public WfTaskSummaryForm getBjsj(String qsid ,String templateCode) {
		Page<WfTaskSummaryForm> pageT = new Page<WfTaskSummaryForm>(10);
		WfTaskSummaryForm form = null ;// 建立新的分页对象
		try{
			Page pg = PageUtils.newPageInstance(pageT);
			// 查询语句及参数
			String tempHql = "select distinct inst, proc, temp.templateName, type.templateTypeName" +
					" from Jbpm4HistTask task, Jbpm4HistProcinst proc, WfBusInstance inst, WfBusTemplate temp, WfBusTemplateType type" +
					" where task.procInstId = proc.procInstId and proc.procInstId = inst.procInstId" +
					" and inst.templateId = temp.id and temp.templateTypeId = type.id" +
					" and inst.masterEntityKey =:qsid and temp.templateCode =:templateCode" +
					" and proc.state=:procState and task.state=:taskState" ;
			StringBuffer hql = new StringBuffer(tempHql);
			Map<String, Object> values = new HashMap();
			values.put("procState", HistoryProcessInstance.STATE_ENDED);
			values.put("taskState", HistoryTask.STATE_COMPLETED);
			values.put("qsid", qsid);
			values.put("templateCode", templateCode);
			// 执行分页查询操作
			jbpm4HistTaskDao.findPageByScrollMode(pg, hql.toString(), values);
			// 转换为Form对象列表并赋值到原分页对象中
			List<WfTaskSummaryForm> list = WfTaskSummaryConvertor.convertBusSummaryList(pg.getResult());
			if(list!=null && list.size()>0){
				form = list.get(0);
			}			
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return form;
	}

	public String importData( Map map) {
		String result="";
		String contextpath=(String) map.get("contextPath");
		String templateCode=(String) map.get("templateCode");
		String ajid=(String) map.get("id");
		String qybh = (String) map.get("qybh");
	    
        //查询上传的材料
        String filepath=this.shljYsService.getSqbFilePath(map);
        filepath=(contextpath+filepath).replace("/", File.separator);
        if(StringUtils.isNotBlank(filepath)){
        	try{
            	InputStream is=new FileInputStream(filepath);
            	ywHwXminfoService.importExcel(is, Long.parseLong(qybh), Long.parseLong(ajid),templateCode);
        	} catch (Exception e) {
				  result+="收件材料没有符合条件的文件\n";
		    }
        }else{
            result+="收件材料没有符合条件的文件\n";
            
        }
		return null;
	}
	
	
	public  List getfblist(String templateCode,Long ysid) {
		Page<WfTaskSummaryForm> pageT = new Page<WfTaskSummaryForm>(10);
		List idlist = new ArrayList();
		try{
			Page pg = PageUtils.newPageInstance(pageT);
			// 查询语句及参数
			String tempHql = "select distinct inst, proc, temp.templateName, type.templateTypeName" +
					" from Jbpm4HistTask task, Jbpm4HistProcinst proc, WfBusInstance inst, WfBusTemplate temp, WfBusTemplateType type, ShljqsBa qsba" +
					" where task.procInstId = proc.procInstId and proc.procInstId = inst.procInstId" +
					" and inst.templateId = temp.id and temp.templateTypeId = type.id" +
					" and inst.masterEntityKey = qsba.id and temp.templateCode =:templateCode and qsba.ysid=:ysid" +
					" and proc.state=:procState and task.state=:taskState" +
					" order by proc.end asc" ;
			StringBuffer hql = new StringBuffer(tempHql);
			Map<String, Object> values = new HashMap();
			values.put("procState", HistoryProcessInstance.STATE_ENDED);
			values.put("taskState", HistoryTask.STATE_COMPLETED);
			values.put("templateCode", templateCode);
			values.put("ysid", ysid);
			// 执行分页查询操作
			jbpm4HistTaskDao.findPageByScrollMode(pg, hql.toString(), values);
			// 转换为Form对象列表并赋值到原分页对象中
	//		List<WfTaskSummaryForm> list = WfTaskSummaryConvertor.convertBusSummaryList(pg.getResult());
			List<Object[]> list = pg.getResult();
			if(list !=null && list.size()>0){
				for(Object[] objs : list){
					WfBusInstance inst  = (WfBusInstance)objs[0];
					if(inst!=null && inst.getMasterEntityKey()!=null){
						idlist.addAll( ywHwXminfoService.getFbXminfo(Long.parseLong(inst.getMasterEntityKey()), templateCode));
					}
				}
			}
			
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}		
		return idlist;
	}
	/**
	 * ��������ȡForm����
	 */
	@Transactional(readOnly = true)
	public ShljqsBaForm getForm(Long id) {
		ShljqsBa entity = shljqsBaDao.get(id);
		ShljqsForm qsForm =	smartFormShljqsService.getForm(entity.getYsid(), "hw_shljqs_v1");
		ShljqsBaForm form=ShljqsBaConvertor.convertVoToForm(entity, qsForm);
		form.setProjectName(entity.getProjectName());
		return form;
	}

	/**
	 * 写入副本信息
	 */
	public String writeFbData(ShljqsBaForm form, String context, String inpath) {
		inpath=inpath.replace("/", File.separator);
        String tempOutPath="Templates/csshlj/outfile/xkzfb/outfile";
        String fileName = GetFileName.getFileName("xls");
        tempOutPath=this.buildPath(tempOutPath, fileName);
        String outfilepath=context+"/"+tempOutPath;
        outfilepath=outfilepath.replace("/", File.separator);
        String outdir=outfilepath.substring(0,outfilepath.lastIndexOf(File.separator));
        File file=new File(outdir);
        if(!file.exists()){
            file.mkdirs();
        }
        ShljqsForm forms=this.smartFormShljqsService.getForm(form.getYsid(),"HW_SHLJQS_V1");
        writerFbDataExcel(inpath,outfilepath,forms,form);
        
		return tempOutPath;
	}
	
    /**
     * 复制副本写入数据
     * @param inpath
     * @param outfilepath
     * @param form
     */
    private void writerFbDataExcel(String inpath, String outfilepath,
    		ShljqsForm form,ShljqsBaForm baform) {
        WritableWorkbook wwb;
        try {
            wwb = ExcelUtil.createWorkbookByOld(inpath, outfilepath);
            WritableSheet wsOne = ExcelUtil.getWritableSheetByIndex(wwb, 0);
            copyFbData(wsOne,form,baform);
            WritableSheet wsTwo = ExcelUtil.getWritableSheetByIndex(wwb, 1);
            copyFbData2(wsTwo,form,baform);//先屏蔽副本后面的地方
            wwb.write();
            wwb.close();
        } catch (Exception e) {
            log.error("写文件错误"+e);
        } 
    }
    /**
     * 写副本第二页数据
     * @param wsOne
     * @param form
     */
    private void copyFbData2(WritableSheet wsOne, ShljqsForm form,ShljqsBaForm baform) {
    	 try {
			 WritableCellFormat wcfBottomBorder = ExcelUtil.createCellFormat2("宋体", 10, Alignment.CENTRE, VerticalAlignment.CENTRE,false,null,null,null,Border.BOTTOM);
			 WritableCellFormat wcfxmnrLeftBorder = ExcelUtil.createCellFormat2("宋体", 10, Alignment.LEFT, VerticalAlignment.TOP,true,Border.LEFT,Border.RIGHT,null,null);
			 wcfBottomBorder.setLocked(false);
             List list2 =new ArrayList();
             list2 = ywHwXminfoService.getFbXminfo(form.getId(), "shljys");
             
             //第二页左边开始
             ShljProject project=this.ywHwXminfoService.getProjectByPrintInfo(baform,3,1);
			 if(project!=null){
                 String xmnr =project.getXmcontent();
                 xmnr = xmnr.replaceAll("<br>", "\r\n");
                 xmnr = xmnr.replaceAll("&nbsp;", " ");
                 xmnr +="\r\n  有效期限：";
                 String startday = project.getStartday();
                 String endday = project.getEndday();
                 if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
                	 xmnr +="从"+startday+"到"+endday;
                 }
    			 ExcelUtil.modiStrCell2(wsOne,1, 3, xmnr==null?"":xmnr, wcfxmnrLeftBorder);//项目内容
                 String fzsj = project.getGzsjday();
                 String year="";
                 String month="";
                 String day="";
                 if(fzsj!=null && fzsj.length()>4){
                	 year = fzsj.substring(0, 4);
                	 month = fzsj.substring(5, 7);
                	 day = fzsj.substring(8, 10);
        			 ExcelUtil.modiStrCell2(wsOne,11, 7, year==null?"":year, wcfBottomBorder);//变更盖章年
        			 ExcelUtil.modiStrCell2(wsOne,14, 7, month==null?"":month, wcfBottomBorder);//变更盖章月
        			 ExcelUtil.modiStrCell2(wsOne,16, 7, day==null?"":day, wcfBottomBorder);//变更盖章日
                 }
                 
			 }
			 ShljProject project1=this.ywHwXminfoService.getProjectByPrintInfo(baform,3,2);
			 if(project1!=null){
                	 String xmnr =project1.getXmcontent();;
                     xmnr = xmnr.replaceAll("<br>", "\r\n");
                     xmnr = xmnr.replaceAll("&nbsp;", " ");
                     xmnr +="\r\n  有效期限：";
                     String startday = project1.getStartday();
                     String endday = project1.getEndday();
                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
                    	 xmnr +="从"+startday+"到"+endday;
                     }
        			 ExcelUtil.modiStrCell2(wsOne,1, 9, xmnr==null?"":xmnr, wcfxmnrLeftBorder);//项目内容
                    String fzsj = project1.getGzsjday();
                    String year="";
                    String month="";
                    String day="";
                     if(fzsj!=null && fzsj.length()>0){
                    	 year = fzsj.substring(0, 4);
                    	 month = fzsj.substring(5, 7);
                    	 day = fzsj.substring(8, 10);
            			 ExcelUtil.modiStrCell2(wsOne,11, 17, year==null?"":year, wcfBottomBorder);//变更盖章年
            			 ExcelUtil.modiStrCell2(wsOne,14, 17, month==null?"":month, wcfBottomBorder);//变更盖章月
            			 ExcelUtil.modiStrCell2(wsOne,16, 17, day==null?"":day, wcfBottomBorder);//变更盖章日
                     }
                 }
			 ShljProject project2=this.ywHwXminfoService.getProjectByPrintInfo(baform,3,3);
                 if(project2!=null){
                	 String xmnr =project2.getXmcontent();
                     xmnr = xmnr.replaceAll("<br>", "\r\n");
                     xmnr = xmnr.replaceAll("&nbsp;", " ");
                     xmnr +="\r\n  有效期限：";
                     String startday = project2.getStartday();
                     String endday = project2.getEndday();
                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
                    	 xmnr +="从"+startday+"到"+endday;
                     }
        			 ExcelUtil.modiStrCell2(wsOne,1, 19, xmnr==null?"":xmnr, wcfxmnrLeftBorder);//项目内容
        			 String fzsj = project2.getGzsjday();
        			 String year="";
        			 String month="";
        			 String day="";
                     if(fzsj!=null && fzsj.length()>0){
                    	 year = fzsj.substring(0, 4);
                    	 month = fzsj.substring(5, 7);
                    	 day = fzsj.substring(8, 10);
            			 ExcelUtil.modiStrCell2(wsOne,11, 26, year==null?"":year, wcfBottomBorder);//变更盖章年
            			 ExcelUtil.modiStrCell2(wsOne,14, 26, month==null?"":month, wcfBottomBorder);//变更盖章月
            			 ExcelUtil.modiStrCell2(wsOne,16, 26, day==null?"":day, wcfBottomBorder);//变更盖章日
                     }
                 }
                 //第二页左边结束
                 
                 //第三页右边开始
                 ShljProject project31=this.ywHwXminfoService.getProjectByPrintInfo(baform,4,1);
    			 if(project31!=null){
                     String xmnr =project31.getXmcontent();
                     xmnr = xmnr.replaceAll("<br>", "\r\n");
                     xmnr = xmnr.replaceAll("&nbsp;", " ");
                     xmnr +="\r\n  有效期限：";
                     String startday = project31.getStartday();
                     String endday = project31.getEndday();
                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
                    	 xmnr +="从"+startday+"到"+endday;
                     }
        			 ExcelUtil.modiStrCell2(wsOne,21, 3, xmnr==null?"":xmnr, wcfxmnrLeftBorder);//项目内容
                     String fzsj = project31.getGzsjday();
                     String year="";
                     String month="";
                     String day="";
                     if(fzsj!=null && fzsj.length()>4){
                    	 year = fzsj.substring(0, 4);
                    	 month = fzsj.substring(5, 7);
                    	 day = fzsj.substring(8, 10);
            			 ExcelUtil.modiStrCell2(wsOne,31, 7, year==null?"":year, wcfBottomBorder);//变更盖章年
            			 ExcelUtil.modiStrCell2(wsOne,34, 7, month==null?"":month, wcfBottomBorder);//变更盖章月
            			 ExcelUtil.modiStrCell2(wsOne,36, 7, day==null?"":day, wcfBottomBorder);//变更盖章日
                     }                     
    			 }
    			 ShljProject project32=this.ywHwXminfoService.getProjectByPrintInfo(baform,4,2);
    			 if(project32!=null){
                     String xmnr =project32.getXmcontent();
                     xmnr = xmnr.replaceAll("<br>", "\r\n");
                     xmnr = xmnr.replaceAll("&nbsp;", " ");
                     xmnr +="\r\n  有效期限：";
                     String startday = project32.getStartday();
                     String endday = project32.getEndday();
                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
                    	 xmnr +="从"+startday+"到"+endday;
                     }
        			 ExcelUtil.modiStrCell2(wsOne,21, 9, xmnr==null?"":xmnr, wcfxmnrLeftBorder);//项目内容
                     String fzsj = project32.getGzsjday();
                     String year="";
                     String month="";
                     String day="";
                     if(fzsj!=null && fzsj.length()>4){
                    	 year = fzsj.substring(0, 4);
                    	 month = fzsj.substring(5, 7);
                    	 day = fzsj.substring(8, 10);
            			 ExcelUtil.modiStrCell2(wsOne,31, 17, year==null?"":year, wcfBottomBorder);//变更盖章年
            			 ExcelUtil.modiStrCell2(wsOne,34, 17, month==null?"":month, wcfBottomBorder);//变更盖章月
            			 ExcelUtil.modiStrCell2(wsOne,36, 17, day==null?"":day, wcfBottomBorder);//变更盖章日
                     }                     
    			 }
    			 ShljProject project33=this.ywHwXminfoService.getProjectByPrintInfo(baform,4,3);
    			 if(project33!=null){
                     String xmnr =project33.getXmcontent();
                     xmnr = xmnr.replaceAll("<br>", "\r\n");
                     xmnr = xmnr.replaceAll("&nbsp;", " ");
                     xmnr +="\r\n  有效期限：";
                     String startday = project33.getStartday();
                     String endday = project33.getEndday();
                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
                    	 xmnr +="从"+startday+"到"+endday;
                     }
        			 ExcelUtil.modiStrCell2(wsOne,21, 19, xmnr==null?"":xmnr, wcfxmnrLeftBorder);//项目内容
                     String fzsj = project33.getGzsjday();
                     String year="";
                     String month="";
                     String day="";
                     if(fzsj!=null && fzsj.length()>4){
                    	 year = fzsj.substring(0, 4);
                    	 month = fzsj.substring(5, 7);
                    	 day = fzsj.substring(8, 10);
            			 ExcelUtil.modiStrCell2(wsOne,31, 26, year==null?"":year, wcfBottomBorder);//变更盖章年
            			 ExcelUtil.modiStrCell2(wsOne,34, 26, month==null?"":month, wcfBottomBorder);//变更盖章月
            			 ExcelUtil.modiStrCell2(wsOne,36, 26, day==null?"":day, wcfBottomBorder);//变更盖章日
                     }                     
    			 }
    			 //第三页右边结束
		} catch (Exception e) {
			e.printStackTrace();
		} 
         
        
    }
    /**
     * 写数据
     * @param wsOne
     * @param form
     */
    private void copyFbData(WritableSheet wsOne, ShljqsForm form,ShljqsBaForm baform) {
    	 try {
    		 WritableCellFormat wcf=ExcelUtil.createCellFormat("宋体", 12, Alignment.LEFT, VerticalAlignment.CENTRE,false);
			 WritableCellFormat wcf1=ExcelUtil.createCellFormat("宋体", 12, Alignment.LEFT, VerticalAlignment.CENTRE,true);
			 WritableCellFormat wcf2=ExcelUtil.createCellFormat("宋体", 12, Alignment.LEFT, VerticalAlignment.CENTRE,false);
			 WritableCellFormat wcf3=ExcelUtil.createCellFormat("宋体", 12, Alignment.LEFT, VerticalAlignment.TOP,false);
			 WritableCellFormat wcfdate=ExcelUtil.createCellFormat("宋体", 8, Alignment.LEFT, VerticalAlignment.CENTRE,false);
			 WritableCellFormat wcfxmnr=ExcelUtil.createCellFormat("宋体", 10, Alignment.LEFT, VerticalAlignment.TOP,true);
			 WritableCellFormat wcfxmrq=ExcelUtil.createCellFormat("宋体", 10, Alignment.RIGHT, VerticalAlignment.CENTRE,false);
			 WritableCellFormat wcfxmrq2=ExcelUtil.createCellFormat("宋体", 10, Alignment.RIGHT, VerticalAlignment.BOTTOM,false);
			 WritableCellFormat wcfxmrq3=ExcelUtil.createCellFormat("宋体", 10, Alignment.CENTRE, VerticalAlignment.CENTRE,false);
			 WritableCellFormat wcfxmrq4=ExcelUtil.createCellFormat("宋体", 10, Alignment.RIGHT, VerticalAlignment.TOP,false);
			 wcf.setLocked(false);
			 wcf1.setLocked(false);
			 wcf2.setLocked(false);
			 wcf3.setLocked(false);
			 wcfdate.setLocked(false);
			 if("yes".equals(baform.getIsprint())){
				 ExcelUtil.modiStrCell2(wsOne, 1, 1, form.getSqdw()==null?"":form.getSqdw(), wcf);//申请单位
				 ExcelUtil.modiStrCell2(wsOne,1, 2, form.getAddress()==null?"":form.getAddress(), wcf1);//地址
				 ExcelUtil.modiStrCell2(wsOne,1, 4, form.getYyzch()==null?"":form.getYyzch(), wcf);//营业执照注册号
				 ExcelUtil.modiStrCell2(wsOne,1, 5, form.getZczb()==null?"":form.getZczb(), wcf);//注册资本
				 ExcelUtil.modiStrCell2(wsOne,1, 7, form.getFddbr()==null?"":form.getFddbr(), wcf2);//法定代表人
				 ExcelUtil.modiStrCell2(wsOne,8, 7, form.getFddbrZw()==null?"":form.getFddbrZw(), wcf2);//职务
				 ExcelUtil.modiStrCell2(wsOne,17, 7, form.getFddbrZc()==null?"":form.getFddbrZc(), wcf2);//职称
				 ExcelUtil.modiStrCell2(wsOne,1, 9, form.getQyManager()==null?"":form.getQyManager(), wcf2);//企业负责人
				 ExcelUtil.modiStrCell2(wsOne,8, 9,form.getQyMaangerZw()==null?"":form.getQyMaangerZw(), wcf2);//职务
				 ExcelUtil.modiStrCell2(wsOne,17, 9,form.getQyManagerZc()==null?"":form.getQyManagerZc(), wcf2);//职称
				 if("1".equals(form.getQylx())){//内资企业
					  ExcelUtil.modiStrCell2(wsOne,1, 11,"√", wcf2);//企业类型内资
				 }else if ("2".equals(form.getQylx())){
					  ExcelUtil.modiStrCell2(wsOne,9, 11,"√", wcf2);//企业类型 港澳台
				 } else if ("2".equals(form.getQylx())){
				  ExcelUtil.modiStrCell2(wsOne,1, 12,"√", wcf2);//企业类型 外商
				}else if ("2".equals(form.getQylx())){
				  ExcelUtil.modiStrCell2(wsOne,9, 12,"√", wcf2);//企业类型 台资
				}
	      
				 ExcelUtil.modiStrCell2(wsOne,2, 15, form.getQygyzb()==null?"":form.getQygyzb(), wcf2);//企业资本构成比例 国有
				 ExcelUtil.modiStrCell2(wsOne,11, 15, form.getQygrzb()==null?"":form.getQygrzb(), wcf2);//企业资本构成比例 个人
				 ExcelUtil.modiStrCell2(wsOne,2, 16, form.getQywszb()==null?"":form.getQywszb(), wcf2);//企业资本构成比例 外商
				 ExcelUtil.modiStrCell2(wsOne,13, 16, form.getQyhzzb()==null?"":form.getQyhzzb(), wcf2);//企业资本构成比例 港澳
				 
				 ExcelUtil.modiStrCell2(wsOne,1, 19, form.getXkContent()==null?"":form.getXkContent(), wcf2);//许可正内容
				 
				 ExcelUtil.modiStrCell2(wsOne,1, 21, form.getFzjg()==null?"":form.getFzjg(), wcf2);//许可发证机关
				 
				 ExcelUtil.modiStrCell2(wsOne,15, 22, form.getJdTel()==null?"":form.getJdTel(), wcf2);//监督电话
				 
				 ExcelUtil.modiStrCell2(wsOne,1, 24, form.getStartYear()==null?"":form.getStartYear(), wcfxmrq3);//许可正发证日期

				 ExcelUtil.modiStrCell2(wsOne,4, 24, form.getStartMonth()==null?"":form.getStartMonth(), wcfxmrq3);//许可正发证日期--

				 ExcelUtil.modiStrCell2(wsOne,7, 24, form.getStartDay()==null?"":form.getStartDay(), wcfxmrq3);//许可正发证日期
	      
				 ExcelUtil.modiStrCell2(wsOne,10, 24, form.getEndYear()==null?"":form.getEndYear(), wcf2);//许可正发证日期

				 ExcelUtil.modiStrCell2(wsOne,13, 24, form.getEndMonth()==null?"":form.getEndMonth(), wcfxmrq);//许可正发证日期

				 ExcelUtil.modiStrCell2(wsOne,16, 24, form.getEndDay()==null?"":form.getEndDay(), wcfxmrq);//许可正发证日期
	      
				 ExcelUtil.modiStrCell2(wsOne,1, 26, form.getFzrq()==null?"":form.getFzrq(), wcf2);//许可正发证日期
				 ExcelUtil.modiStrCell2(wsOne,18, 26, form.getZsbh()==null?"":form.getZsbh(), wcf2);//许可正发证日期
			 }

			 ShljProject project=this.ywHwXminfoService.getProjectByPrintInfo(baform,2,1);
			 if(project!=null){
				 ExcelUtil.modiStrCell2(wsOne,22, 3, project.getXmcontent(), wcfxmnr);//项目记录1
				  if(StringUtils.isNotBlank(project.getGzsjday())){
					 String fzsj=project.getGzsjday();
	             	 String year = fzsj.substring(0, 4);
	             	 String month = fzsj.substring(5, 7);
	             	 String day = fzsj.substring(8, 10);
	     			 ExcelUtil.modiStrCell2(wsOne,27, 6, year==null?"":year, wcfxmrq);//项目盖章年
	     			 ExcelUtil.modiStrCell2(wsOne,29, 6, month==null?"":month, wcfxmrq);//项目盖章月
	     			 ExcelUtil.modiStrCell2(wsOne,31, 6, day==null?"":day, wcfxmrq);//项目盖章日
	     			String startday = project.getStartday();
	                String endday = project.getEndday();
	                if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
	               	 String date="有效期从"+startday+"到"+endday;
	                 ExcelUtil.modiStrCell2(wsOne,22, 5, date, wcfxmnr);//项目内容时间
	                }
	              }
			 }
		
			 	ShljProject project1=this.ywHwXminfoService.getProjectByPrintInfo(baform,2,2);
			 	if(project1!=null){
					 ExcelUtil.modiStrCell2(wsOne,22, 9, project1.getXmcontent(), wcfxmnr);//项目记录1
					  if(StringUtils.isNotBlank(project1.getGzsjday())){
						 String fzsj=project1.getGzsjday();
		             	 String year = fzsj.substring(0, 4);
		             	 String month = fzsj.substring(5, 7);
		             	 String day = fzsj.substring(8, 10);
		     			 ExcelUtil.modiStrCell2(wsOne,27, 17, year==null?"":year, wcfxmrq);//项目盖章年
		     			 ExcelUtil.modiStrCell2(wsOne,29, 17, month==null?"":month, wcfxmrq);//项目盖章月
		     			 ExcelUtil.modiStrCell2(wsOne,31, 17, day==null?"":day, wcfxmrq);//项目盖章日
		     			String startday = project1.getStartday();
		                String endday = project1.getEndday();
		                if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
		               	 String date="有效期从"+startday+"到"+endday;
		                 ExcelUtil.modiStrCell2(wsOne,22, 15, date, wcfxmnr);//项目内容时间
		                }
		              }
					  
				 
			 	}
			 	ShljProject project2=this.ywHwXminfoService.getProjectByPrintInfo(baform,2,3);
			 	if(project2!=null){
					 ExcelUtil.modiStrCell2(wsOne,22, 21, project2.getXmcontent(), wcfxmnr);//项目记录1
					  if(StringUtils.isNotBlank(project2.getGzsjday())){
						 String fzsj=project2.getGzsjday();
		             	 String year = fzsj.substring(0, 4);
		             	 String month = fzsj.substring(5, 7);
		             	 String day = fzsj.substring(8, 10);
		     			 ExcelUtil.modiStrCell2(wsOne,27, 27, year==null?"":year, wcfxmrq4);//项目盖章年
		     			 ExcelUtil.modiStrCell2(wsOne,29, 27, month==null?"":month, wcfxmrq4);//项目盖章月
		     			 ExcelUtil.modiStrCell2(wsOne,31, 27, day==null?"":day, wcfxmrq4);//项目盖章日
		     			String startday = project2.getStartday();
		                String endday = project2.getEndday();
		                if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
		               	 String date="有效期从"+startday+"到"+endday;
		                 ExcelUtil.modiStrCell2(wsOne,22, 24, date, wcfxmnr);//项目内容时间
		                }
		              }
			 	}
			
				

//             List list2 =new ArrayList();
//             list2 = ywHwXminfoService.getFbXminfo(form.getId(), "shljys");
//             if(list2!=null && list2.size()>0){
//                 Map<String, String> map2 =(Map<String, String>) list2.get(0);
//                 String xmnr =map2.get("xmnr");
//                 xmnr = xmnr.replaceAll("<br>", "\r\n");
//                 xmnr = xmnr.replaceAll("&nbsp;", " ");
//                 xmnr +="\r\n  有效期限：";
//                 String startday = map2.get("startday");
//                 String endday = map2.get("endday");
//                 if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
//                	 xmnr +="从"+startday+"到"+endday;
//                 }
//    			 ExcelUtil.modiStrCell2(wsOne,22, 2, xmnr==null?"":xmnr, wcfxmnr);//项目内容
//                 String fzsj = map2.get("gzsj");
//                 String year="";
//                 String month="";
//                 String day="";
//                 if(fzsj!=null && fzsj.length()>0){
//                	 year = fzsj.substring(0, 4);
//                	 month = fzsj.substring(5, 7);
//                	 day = fzsj.substring(8, 10);
//        			 ExcelUtil.modiStrCell2(wsOne,27, 5, year==null?"":year, wcfxmrq);//变更盖章年
//        			 ExcelUtil.modiStrCell2(wsOne,29, 5, month==null?"":month, wcfxmrq);//变更盖章月
//        			 ExcelUtil.modiStrCell2(wsOne,31, 5, day==null?"":day, wcfxmrq);//变更盖章日
//                 }
//                 if(list2.size()>1){
//                	 map2 =(Map<String, String>) list2.get(1);
//                	 xmnr =map2.get("xmnr");
//                     xmnr = xmnr.replaceAll("<br>", "\r\n");
//                     xmnr = xmnr.replaceAll("&nbsp;", " ");
//                     xmnr +="\r\n  有效期限：";
//                     startday = map2.get("startday");
//                     endday = map2.get("endday");
//                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
//                    	 xmnr +="从"+startday+"到"+endday;
//                     }
//        			 ExcelUtil.modiStrCell2(wsOne,22, 8, xmnr==null?"":xmnr, wcfxmnr);//项目内容
//                     fzsj = map2.get("gzsj");
//                     year="";
//                     month="";
//                     day="";
//                     if(fzsj!=null && fzsj.length()>0){
//                    	 year = fzsj.substring(0, 4);
//                    	 month = fzsj.substring(5, 7);
//                    	 day = fzsj.substring(8, 10);
//            			 ExcelUtil.modiStrCell2(wsOne,27, 16, year==null?"":year, wcfxmrq);//变更盖章年
//            			 ExcelUtil.modiStrCell2(wsOne,29, 16, month==null?"":month, wcfxmrq);//变更盖章月
//            			 ExcelUtil.modiStrCell2(wsOne,31, 16, day==null?"":day, wcfxmrq);//变更盖章日
//                     }
//                 }
//                 if(list2.size()>2){
//                	 map2 =(Map<String, String>) list2.get(1);
//                	 xmnr =map2.get("xmnr");
//                     xmnr = xmnr.replaceAll("<br>", "\r\n");
//                     xmnr = xmnr.replaceAll("&nbsp;", " ");
//                     xmnr +="\r\n  有效期限：";
//                     startday = map2.get("startday");
//                     endday = map2.get("endday");
//                     if(startday!=null && startday.length()>0 && endday!=null && endday.length()>0){
//                    	 xmnr +="从"+startday+"到"+endday;
//                     }
//        			 ExcelUtil.modiStrCell2(wsOne,22, 20, xmnr==null?"":xmnr, wcfxmnr);//项目内容
//                     fzsj = map2.get("gzsj");
//                     year="";
//                     month="";
//                     day="";
//                     if(fzsj!=null && fzsj.length()>0){
//                    	 year = fzsj.substring(0, 4);
//                    	 month = fzsj.substring(5, 7);
//                    	 day = fzsj.substring(8, 10);
//            			 ExcelUtil.modiStrCell2(wsOne,27, 26, year==null?"":year, wcfxmrq);//变更盖章年
//            			 ExcelUtil.modiStrCell2(wsOne,29, 26, month==null?"":month, wcfxmrq);//变更盖章月
//            			 ExcelUtil.modiStrCell2(wsOne,31, 26, day==null?"":day, wcfxmrq);//变更盖章日
//                     }
             //   }
             //}
		} catch (Exception e) {
			e.printStackTrace();
		}
    }
    
    /**
     * 生成后面的文件路径加上年月
     * @param realpath 定义的目录
     * @param fileNamesuffix 文件后缀名
     * @return
     */
    private String buildPath(String realpath,String fileName){
        String dateDir = GetFileName.getDirector();
        return realpath+"/"+dateDir+"/"+fileName;
    }
    
    public String wfBusYslTuih(ShljqsBaForm form,LoginUserForm loginUser) throws Exception {
    	String  loginUserName = loginUser.getUser().getUserName();
    	WfBusInstanceTaskForm taskForm = new WfBusInstanceTaskForm();
		taskForm.setHandleComments("资料不全，不予受理。");
		//把审批状态数据保存到ywWebserviceInfo ，交换给方欣
		ywWebserviceInfoService.saveYwWebserviceInfo(form.getSqrq(), form.getAcceptNo(), form.getCbyw(), form.getJbrxm(), form.getSjr(), form.getSqdw(), 
				form.getBusinessCode(), form.getApprovalNo(), loginUserName, loginUser.getOrg().getOrgName(), "ysl", new Date(), false, "预受理", taskForm);
//		System.out.println("form.getYslThyy() = "+java.net.URLDecoder.decode(form.getYslThyy(),"UTF-8"));
		this.changeYslState(form.getId(), 0L,taskForm.getHandleComments());
		
		//（网办）交换到市民网页
		Map map=exchangeStateService.buildMap(loginUser, null, form.getId().toString(), form.getTemplateCode(), false);
		String durationExpression = wfServiceEX.getDurationExpressionByTemplateCode(form.getTemplateCode());
		ywWebserviceForWbService.setValueAndSaveYwWebserviceForWb(loginUserName,form.getTemplateCode(),
				form.getId().toString(),durationExpression,"001",taskForm.getHandleComments(), map);
    	return null;
    }

    /*
     * (non-Javadoc)
     * @see com.augurit.gzcgwsp.csshlj.service.IShljqsBaService#getProjects(com.augurit.gzcgwsp.csshlj.form.ShljqsBaForm)
     */
	@Override
	public List getProjects(ShljqsBaForm form,int startnum,int endnum) {
		List  list = ywHwXminfoService.getProjects(Long.valueOf(form.getQybh()), startnum, endnum,form.getId());
		return list;
	}
    
}
